﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.Diagnostics;

namespace DARE
{
    public class CMeshController : CAnimationController
    {
        //#region Fields

        //private CModel m_model;
        //private Dictionary<int, int> m_indexer;
        //private Matrix[] worldTransforms;
        ////private 
        //#endregion

        public CMeshController()
            : base((CHierarchy)null)
        {

        }

        //#region CTOR

        //public CMeshController(CAnimNode[] _nodes, CModel _model)
        //    : this(new CHierarchy(_nodes), _model)
        //{
        //}

        //public CMeshController(CHierarchy _hierarchy, CModel _model)
        //    : base(_hierarchy)
        //{
        //    worldTransforms = new Matrix[_hierarchy.BonesCount];
        //    m_model = _model;

        //    m_indexer = new Dictionary<int, int>();
        //    for (int i = 0; i < _model.Model.Meshes.Count; ++i)
        //    {
        //        m_indexer.Add(i, _hierarchy.GetIndexByName(_model.Model.Meshes[i].Name));
        //    }
        //}

        //#endregion

        //#region Method

        //protected override void HierachiTransfom(Matrix world)
        //{
        //    worldTransforms[0] = boneTransforms[0] * world;

        //    // Child bones.
        //    for (int bone = 1; bone < worldTransforms.Length; bone++)
        //    {
        //        int parentBone = this.m_hierarchy[bone].ParentIndex;

        //        if (parentBone == -1)
        //            worldTransforms[bone] = boneTransforms[bone] * world;
        //        else
        //            worldTransforms[bone] = boneTransforms[bone] * worldTransforms[parentBone];
        //    }

        //    for (int i = 0; i < m_model.Meshes.Length; ++i)
        //    {
        //        m_model.Meshes[m_indexer[i]].m_relative = worldTransforms[i];
        //    }
        //}

        //#endregion
    }
}
